from hytest import GSTORE, INFO, STEP, CHECK_POINT
from lib.webui.TeacherOp import top
from lib.webui.StudentOp import sop


class TeacherWeb3:
    name = '老师发布作业 - tc005100'

    def teststeps(self):
        STEP(1, '数学老师登录')

        top.teacherLogin(username='anran', password='888888')

        STEP(2, '发布三道选择题作业')

        top.publishHomework(homeworkName="数学作业1")
        info = top.getAddHomewordInfo()

        CHECK_POINT("发布作业检查", info == '数学作业1')

        STEP(3, '学生登录')

        sop.studentLogin(username='dxs', password='888888')

        STEP(4, '学生完成作业')

        ret = sop.doHomeWork()

        CHECK_POINT("学生完成作业检查", ret == True)

        STEP(5, '老师再次登陆')

        top.teacherLogin(username='anran', password='888888')

        STEP(6, '作业完成情况')

        info = top.getPublishHomeworkStuInfo()

        CHECK_POINT("作业完成情况检查", info == '大学生')


class TeacherWeb4:
    name = '老师发布作业 - tc005101'

    def teststeps(self):
        STEP(1, '数学老师登录')

        top.teacherLogin(username='anran', password='888888')

        STEP(2, '发布作业-作业名为空字符串')

        top.publishEmptyHomework(homeworkName="")
        homeworkName = top.getAddHomewordInfo()

        CHECK_POINT("发布作业检查", homeworkName is None)


class TeacherWeb5:
    name = '老师发布作业 - tc005102'

    def teststeps(self):
        STEP(1, '数学老师登录')

        top.teacherLogin(username='anran', password='888888')

        STEP(2, '发布作业-作业名1个字符')

        top.publishHomework(homeworkName="h")
        info = top.getAddHomewordInfo()

        CHECK_POINT("发布作业检查", info == 'h')


class TeacherWeb6:
    name = '老师发布作业 - tc005103'

    def teststeps(self):
        STEP(1, '数学老师登录')

        top.teacherLogin(username='anran', password='888888')

        STEP(2, '发布作业-作业名10个字符')

        top.publishHomework(homeworkName="20250702ho")
        info = top.getAddHomewordInfo()

        CHECK_POINT("发布作业检查", info == '20250702ho')


class TeacherWeb7:
    name = '老师发布作业 - tc005104'

    def teststeps(self):
        STEP(1, '数学老师登录')

        top.teacherLogin(username='anran', password='888888')

        STEP(2, '发布作业-作业名99个字符')

        top.publishHomework(homeworkName="***********()********************你好************hh**************************************************")
        info = top.getAddHomewordInfo()

        CHECK_POINT("发布作业检查", info == '***********()********************你好************hh**************************************************')


class TeacherWeb8:
    name = '老师发布作业 - tc005105'

    def teststeps(self):
        STEP(1, '数学老师登录')

        top.teacherLogin(username='anran', password='888888')

        STEP(2, '发布作业-作业名100个字符')

        top.publishHomework(homeworkName="************()********************你好************hh**************************************************")
        info = top.getAddHomewordInfo()

        CHECK_POINT("发布作业检查", info == '************()********************你好************hh**************************************************')


# 创建成功了 - 与预期不符
class TeacherWeb9:
    name = '老师发布作业 - tc005106'

    def teststeps(self):
        STEP(1, '数学老师登录')

        top.teacherLogin(username='anran', password='888888')

        STEP(2, '发布作业-作业名101个字符')

        top.publishHomework(homeworkName="*************()********************你好************hh**************************************************")
        info = top.getAddHomewordInfo()

        CHECK_POINT("发布作业检查", info is None)


# 创建成功了, 与预期不符
class TeacherWeb10:
    name = '老师发布作业 - tc005107'

    def teststeps(self):
        STEP(1, '数学老师登录')

        top.teacherLogin(username='anran', password='888888')

        STEP(2, '发布作业-作业名500个字符')

        top.publishHomework(homeworkName="********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************")
        info = top.getAddHomewordInfo()

        CHECK_POINT("发布作业检查", info is None)
